/*
*	Created:			06.03.10
*	Author:				009
*	Last Modifed:		-
*/

// SDK
#include "SDK/amx/amx.h"
#include "SDK/plugincommon.h"
// plugin
#include "os.h"
#include "hooks.h"
#include "main.h"
// samp data
#include "samp address.h"
#include "samp defines.h"
#include "samp structs.h"
// multithread
#include "multithread.h"

// main vars
DWORD					c_samp;
DWORD					c_players;
DWORD					c_vehicles;
DWORD					CSampPointer;
// remote procedures pointers
f_ClientConnect			ClientConnectPointer;
f_ClientDisconnect		ClientDisconnectPointer;
f_SpawnForWorld			SpawnForWorldPointer;
f_SetSpawnInfoPointer	SetSpawnInfoPointer;
f_SetSkinPointer		SetSkinPointer;
f_KillForWorld			KillForWorldPointer;
f_SetWeaponSkill		SetWeaponSkillPointer;
// offsets
DWORD CPlayerPosXOffset;
DWORD CPlayerPosYOffset;
DWORD CPlayerPosZOffset;
DWORD CPlayerHealthOffset;
DWORD CPlayerArmourOffset;
DWORD CPlayerAngleOffset;
DWORD CPlayerStateOffset;
DWORD CPlayerFootSyncOffset;
DWORD CPlayerInCarSyncOffset;
DWORD CPlayerPassangerSyncOffset;
DWORD CPlayerAimSyncOffset;
DWORD CPlayerAimSyncStateOffset;
DWORD CPlayerSyncTypeOffset;
DWORD CPlayerWeaponSkillOffset;
DWORD CPlayerSkinOffset;
DWORD CPlayerInteriorOffset;
DWORD CPlayerIsStreamedOffset;
DWORD CPlayerVehicleIdOffset;
DWORD CPlayerVehicleSeatOffset;
DWORD CVehiclePosXOffset;
DWORD CVehiclePosYOffset;
DWORD CVehiclePosZOffset;
DWORD CVehicleDriverOffset;
DWORD CVehicleModelOffset;
DWORD CVehicleHealthOffset;

DWORD LoggingJoinPointer;
DWORD LoggingPartPointer;

extern int SampVersion;

//
// ------------------------------------------------------
//

int SpawnForWorld(DWORD c_player_struct)
{
	MUTEX_ENTER(MultiThreadMutex);

	CALL_NOARGS(c_player_struct,SpawnForWorldPointer);

	MUTEX_EXIT(MultiThreadMutex);
	return 1;
}

int SetSpawnInfo(DWORD c_player_struct,int info[])
{
	MUTEX_ENTER(MultiThreadMutex);

	CALL_ARGS(c_player_struct,SetSpawnInfoPointer,info);

	MUTEX_EXIT(MultiThreadMutex);
	return 1;
}

int SetSkinData(int playerid,int skin)
{
	MUTEX_ENTER(MultiThreadMutex);

	int data[3];
	data[1] = playerid;
	data[2] = skin;
	SetSkinPointer(0,data);

	MUTEX_EXIT(MultiThreadMutex);
	return 1;
}

int KillForWorld(DWORD c_player_struct,int killerid,int reason)
{
	MUTEX_ENTER(MultiThreadMutex);

	CALL_ARGS(c_player_struct,KillForWorldPointer,reason _ killerid);

	MUTEX_EXIT(MultiThreadMutex);
	return 1;
}

int SetWeaponSkill(DWORD c_player_struct,int weapontype,int level)
{
	MUTEX_ENTER(MultiThreadMutex);

	CALL_ARGS(c_player_struct,SetWeaponSkillPointer,weapontype _ level);

	MUTEX_EXIT(MultiThreadMutex);
	return 1;
}

void HooksInstall(int version)
{
	// addr
	void *temp;
	switch(version)
	{
	case SAMP_VERSION_034:
		{
			POINTER_TO_MEMBER(ClientConnectPointer,(void *)(R4_CLIENT_CONNECT),f_ClientConnect);
			POINTER_TO_MEMBER(ClientDisconnectPointer,(void *)(R4_CLIENT_DISCONNECT),f_ClientDisconnect);
			POINTER_TO_MEMBER(SpawnForWorldPointer,(void *)(R4_SPAWN_FOR_WORLD),f_SpawnForWorld);
			POINTER_TO_MEMBER(SetSpawnInfoPointer,(void *)(R4_SET_SPAWN_INFO),f_SetSpawnInfoPointer);
			POINTER_TO_MEMBER(SetSkinPointer,(void *)(R4_SET_SKIN),f_SetSkinPointer);
			POINTER_TO_MEMBER(KillForWorldPointer,(void *)(R4_KILL_FOR_WORLD),f_KillForWorld);
			POINTER_TO_MEMBER(SetWeaponSkillPointer,(void *)(R4_SET_WEAPON_SKILL),f_SetWeaponSkill);
			
			POINTER_TO_MEMBER(CPlayerPosXOffset,(void *)(R4_C_PLAYER_POS_X_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerPosYOffset,(void *)(R4_C_PLAYER_POS_Y_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerPosZOffset,(void *)(R4_C_PLAYER_POS_Z_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerHealthOffset,(void *)(R4_C_PLAYER_HEALTH_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerArmourOffset,(void *)(R4_C_PLAYER_ARMOUR_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerAngleOffset,(void *)(R4_C_PLAYER_ANGLE_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerStateOffset,(void *)(R4_C_PLAYER_STATE_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerFootSyncOffset,(void *)(R4_C_PLAYER_FOOT_SYNC_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerInCarSyncOffset,(void *)(R4_C_PLAYER_INCAR_SYNC_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerPassangerSyncOffset,(void *)(R4_C_PLAYER_PASSANGER_SYNC_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerAimSyncOffset,(void *)(R4_C_PLAYER_AIM_SYNC_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerAimSyncStateOffset,(void *)(R4_C_PLAYER_AIM_SYNC_STATE_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerSyncTypeOffset,(void *)(R4_C_PLAYER_SYNC_TYPE_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerWeaponSkillOffset,(void *)(R4_C_PLAYER_WEAPON_SKILL_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerSkinOffset,(void *)(R4_C_PLAYER_SKIN_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerInteriorOffset,(void *)(R4_C_PLAYER_INTERIOR_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerIsStreamedOffset,(void *)(R4_C_PLAYER_IS_STREAMED_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerVehicleIdOffset,(void *)(R4_C_PLAYER_VEHICLE_ID_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerVehicleSeatOffset,(void *)(R4_C_PLAYER_VEHICLE_SEAT_OFFSET),DWORD);
			
			POINTER_TO_MEMBER(CVehiclePosXOffset,(void *)(R4_C_VEHICLE_POS_X_OFFSET),DWORD);
			POINTER_TO_MEMBER(CVehiclePosYOffset,(void *)(R4_C_VEHICLE_POS_Y_OFFSET),DWORD);
			POINTER_TO_MEMBER(CVehiclePosZOffset,(void *)(R4_C_VEHICLE_POS_Z_OFFSET),DWORD);
			POINTER_TO_MEMBER(CVehicleDriverOffset,(void *)(R4_C_VEHICLE_DRIVER_OFFSET),DWORD);
			POINTER_TO_MEMBER(CVehicleModelOffset,(void *)(R4_C_VEHICLE_MODEL_OFFSET),DWORD);
			POINTER_TO_MEMBER(CVehicleHealthOffset,(void *)(R4_C_VEHICLE_HEALTH_OFFSET),DWORD);

			POINTER_TO_MEMBER(LoggingJoinPointer,(void *)(R4_JOIN_POINTER),DWORD);
			POINTER_TO_MEMBER(LoggingPartPointer,(void *)(R4_PART_POINTER),DWORD);
			break;
		}
	case SAMP_VERSION_0351:
		{
			POINTER_TO_MEMBER(ClientConnectPointer,(void *)(R51_CLIENT_CONNECT),f_ClientConnect);
			POINTER_TO_MEMBER(ClientDisconnectPointer,(void *)(R51_CLIENT_DISCONNECT),f_ClientDisconnect);
			POINTER_TO_MEMBER(SpawnForWorldPointer,(void *)(R51_SPAWN_FOR_WORLD),f_SpawnForWorld);
			POINTER_TO_MEMBER(SetSpawnInfoPointer,(void *)(R51_SET_SPAWN_INFO),f_SetSpawnInfoPointer);
			POINTER_TO_MEMBER(SetSkinPointer,(void *)(R51_SET_SKIN),f_SetSkinPointer);
			POINTER_TO_MEMBER(KillForWorldPointer,(void *)(R51_KILL_FOR_WORLD),f_KillForWorld);
			POINTER_TO_MEMBER(SetWeaponSkillPointer,(void *)(R51_SET_WEAPON_SKILL),f_SetWeaponSkill);
			
			POINTER_TO_MEMBER(CPlayerPosXOffset,(void *)(R51_C_PLAYER_POS_X_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerPosYOffset,(void *)(R51_C_PLAYER_POS_Y_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerPosZOffset,(void *)(R51_C_PLAYER_POS_Z_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerHealthOffset,(void *)(R51_C_PLAYER_HEALTH_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerArmourOffset,(void *)(R51_C_PLAYER_ARMOUR_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerAngleOffset,(void *)(R51_C_PLAYER_ANGLE_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerStateOffset,(void *)(R51_C_PLAYER_STATE_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerFootSyncOffset,(void *)(R51_C_PLAYER_FOOT_SYNC_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerInCarSyncOffset,(void *)(R51_C_PLAYER_INCAR_SYNC_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerPassangerSyncOffset,(void *)(R51_C_PLAYER_PASSANGER_SYNC_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerAimSyncOffset,(void *)(R51_C_PLAYER_AIM_SYNC_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerAimSyncStateOffset,(void *)(R51_C_PLAYER_AIM_SYNC_STATE_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerSyncTypeOffset,(void *)(R51_C_PLAYER_SYNC_TYPE_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerWeaponSkillOffset,(void *)(R51_C_PLAYER_WEAPON_SKILL_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerSkinOffset,(void *)(R51_C_PLAYER_SKIN_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerInteriorOffset,(void *)(R51_C_PLAYER_INTERIOR_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerIsStreamedOffset,(void *)(R51_C_PLAYER_IS_STREAMED_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerVehicleIdOffset,(void *)(R51_C_PLAYER_VEHICLE_ID_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerVehicleSeatOffset,(void *)(R51_C_PLAYER_VEHICLE_SEAT_OFFSET),DWORD);
			
			POINTER_TO_MEMBER(CVehiclePosXOffset,(void *)(R51_C_VEHICLE_POS_X_OFFSET),DWORD);
			POINTER_TO_MEMBER(CVehiclePosYOffset,(void *)(R51_C_VEHICLE_POS_Y_OFFSET),DWORD);
			POINTER_TO_MEMBER(CVehiclePosZOffset,(void *)(R51_C_VEHICLE_POS_Z_OFFSET),DWORD);
			POINTER_TO_MEMBER(CVehicleDriverOffset,(void *)(R51_C_VEHICLE_DRIVER_OFFSET),DWORD);
			POINTER_TO_MEMBER(CVehicleModelOffset,(void *)(R51_C_VEHICLE_MODEL_OFFSET),DWORD);
			POINTER_TO_MEMBER(CVehicleHealthOffset,(void *)(R51_C_VEHICLE_HEALTH_OFFSET),DWORD);
			
			POINTER_TO_MEMBER(LoggingJoinPointer,(void *)(R51_JOIN_POINTER),DWORD);
			POINTER_TO_MEMBER(LoggingPartPointer,(void *)(R51_PART_POINTER),DWORD);
			break;
		}
	case SAMP_VERSION_0352:
		{
			POINTER_TO_MEMBER(ClientConnectPointer,(void *)(R52_CLIENT_CONNECT),f_ClientConnect);
			POINTER_TO_MEMBER(ClientDisconnectPointer,(void *)(R52_CLIENT_DISCONNECT),f_ClientDisconnect);
			POINTER_TO_MEMBER(SpawnForWorldPointer,(void *)(R52_SPAWN_FOR_WORLD),f_SpawnForWorld);
			POINTER_TO_MEMBER(SetSpawnInfoPointer,(void *)(R52_SET_SPAWN_INFO),f_SetSpawnInfoPointer);
			POINTER_TO_MEMBER(SetSkinPointer,(void *)(R52_SET_SKIN),f_SetSkinPointer);
			POINTER_TO_MEMBER(KillForWorldPointer,(void *)(R52_KILL_FOR_WORLD),f_KillForWorld);
			POINTER_TO_MEMBER(SetWeaponSkillPointer,(void *)(R52_SET_WEAPON_SKILL),f_SetWeaponSkill);
			
			POINTER_TO_MEMBER(CPlayerPosXOffset,(void *)(R52_C_PLAYER_POS_X_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerPosYOffset,(void *)(R52_C_PLAYER_POS_Y_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerPosZOffset,(void *)(R52_C_PLAYER_POS_Z_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerHealthOffset,(void *)(R52_C_PLAYER_HEALTH_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerArmourOffset,(void *)(R52_C_PLAYER_ARMOUR_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerAngleOffset,(void *)(R52_C_PLAYER_ANGLE_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerStateOffset,(void *)(R52_C_PLAYER_STATE_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerFootSyncOffset,(void *)(R52_C_PLAYER_FOOT_SYNC_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerInCarSyncOffset,(void *)(R52_C_PLAYER_INCAR_SYNC_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerPassangerSyncOffset,(void *)(R52_C_PLAYER_PASSANGER_SYNC_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerAimSyncOffset,(void *)(R52_C_PLAYER_AIM_SYNC_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerAimSyncStateOffset,(void *)(R52_C_PLAYER_AIM_SYNC_STATE_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerSyncTypeOffset,(void *)(R52_C_PLAYER_SYNC_TYPE_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerWeaponSkillOffset,(void *)(R52_C_PLAYER_WEAPON_SKILL_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerSkinOffset,(void *)(R52_C_PLAYER_SKIN_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerInteriorOffset,(void *)(R52_C_PLAYER_INTERIOR_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerIsStreamedOffset,(void *)(R52_C_PLAYER_IS_STREAMED_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerVehicleIdOffset,(void *)(R52_C_PLAYER_VEHICLE_ID_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerVehicleSeatOffset,(void *)(R52_C_PLAYER_VEHICLE_SEAT_OFFSET),DWORD);
			
			POINTER_TO_MEMBER(CVehiclePosXOffset,(void *)(R52_C_VEHICLE_POS_X_OFFSET),DWORD);
			POINTER_TO_MEMBER(CVehiclePosYOffset,(void *)(R52_C_VEHICLE_POS_Y_OFFSET),DWORD);
			POINTER_TO_MEMBER(CVehiclePosZOffset,(void *)(R52_C_VEHICLE_POS_Z_OFFSET),DWORD);
			POINTER_TO_MEMBER(CVehicleDriverOffset,(void *)(R52_C_VEHICLE_DRIVER_OFFSET),DWORD);
			POINTER_TO_MEMBER(CVehicleModelOffset,(void *)(R52_C_VEHICLE_MODEL_OFFSET),DWORD);
			POINTER_TO_MEMBER(CVehicleHealthOffset,(void *)(R52_C_VEHICLE_HEALTH_OFFSET),DWORD);

			POINTER_TO_MEMBER(LoggingJoinPointer,(void *)(R52_JOIN_POINTER),DWORD);
			POINTER_TO_MEMBER(LoggingPartPointer,(void *)(R52_PART_POINTER),DWORD);
			break;
		}
	case SAMP_VERSION_036:
		{
			POINTER_TO_MEMBER(ClientConnectPointer,(void *)(R6_CLIENT_CONNECT),f_ClientConnect);
			POINTER_TO_MEMBER(ClientDisconnectPointer,(void *)(R6_CLIENT_DISCONNECT),f_ClientDisconnect);
			POINTER_TO_MEMBER(SpawnForWorldPointer,(void *)(R6_SPAWN_FOR_WORLD),f_SpawnForWorld);
			POINTER_TO_MEMBER(SetSpawnInfoPointer,(void *)(R6_SET_SPAWN_INFO),f_SetSpawnInfoPointer);
			POINTER_TO_MEMBER(SetSkinPointer,(void *)(R6_SET_SKIN),f_SetSkinPointer);
			POINTER_TO_MEMBER(KillForWorldPointer,(void *)(R6_KILL_FOR_WORLD),f_KillForWorld);
			POINTER_TO_MEMBER(SetWeaponSkillPointer,(void *)(R6_SET_WEAPON_SKILL),f_SetWeaponSkill);
			
			POINTER_TO_MEMBER(CPlayerPosXOffset,(void *)(R6_C_PLAYER_POS_X_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerPosYOffset,(void *)(R6_C_PLAYER_POS_Y_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerPosZOffset,(void *)(R6_C_PLAYER_POS_Z_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerHealthOffset,(void *)(R6_C_PLAYER_HEALTH_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerArmourOffset,(void *)(R6_C_PLAYER_ARMOUR_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerAngleOffset,(void *)(R6_C_PLAYER_ANGLE_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerStateOffset,(void *)(R6_C_PLAYER_STATE_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerFootSyncOffset,(void *)(R6_C_PLAYER_FOOT_SYNC_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerInCarSyncOffset,(void *)(R6_C_PLAYER_INCAR_SYNC_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerPassangerSyncOffset,(void *)(R6_C_PLAYER_PASSANGER_SYNC_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerAimSyncOffset,(void *)(R6_C_PLAYER_AIM_SYNC_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerAimSyncStateOffset,(void *)(R6_C_PLAYER_AIM_SYNC_STATE_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerSyncTypeOffset,(void *)(R6_C_PLAYER_SYNC_TYPE_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerWeaponSkillOffset,(void *)(R6_C_PLAYER_WEAPON_SKILL_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerSkinOffset,(void *)(R6_C_PLAYER_SKIN_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerInteriorOffset,(void *)(R6_C_PLAYER_INTERIOR_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerIsStreamedOffset,(void *)(R6_C_PLAYER_IS_STREAMED_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerVehicleIdOffset,(void *)(R6_C_PLAYER_VEHICLE_ID_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerVehicleSeatOffset,(void *)(R6_C_PLAYER_VEHICLE_SEAT_OFFSET),DWORD);
			
			POINTER_TO_MEMBER(CVehiclePosXOffset,(void *)(R6_C_VEHICLE_POS_X_OFFSET),DWORD);
			POINTER_TO_MEMBER(CVehiclePosYOffset,(void *)(R6_C_VEHICLE_POS_Y_OFFSET),DWORD);
			POINTER_TO_MEMBER(CVehiclePosZOffset,(void *)(R6_C_VEHICLE_POS_Z_OFFSET),DWORD);
			POINTER_TO_MEMBER(CVehicleDriverOffset,(void *)(R6_C_VEHICLE_DRIVER_OFFSET),DWORD);
			POINTER_TO_MEMBER(CVehicleModelOffset,(void *)(R6_C_VEHICLE_MODEL_OFFSET),DWORD);
			POINTER_TO_MEMBER(CVehicleHealthOffset,(void *)(R6_C_VEHICLE_HEALTH_OFFSET),DWORD);

			POINTER_TO_MEMBER(LoggingJoinPointer,(void *)(R6_JOIN_POINTER),DWORD);
			POINTER_TO_MEMBER(LoggingPartPointer,(void *)(R6_PART_POINTER),DWORD);
			break;
		}
	case SAMP_VERSION_037:
		{
			POINTER_TO_MEMBER(ClientConnectPointer,(void *)(R7_CLIENT_CONNECT),f_ClientConnect);
			POINTER_TO_MEMBER(ClientDisconnectPointer,(void *)(R7_CLIENT_DISCONNECT),f_ClientDisconnect);
			POINTER_TO_MEMBER(SpawnForWorldPointer,(void *)(R7_SPAWN_FOR_WORLD),f_SpawnForWorld);
			POINTER_TO_MEMBER(SetSpawnInfoPointer,(void *)(R7_SET_SPAWN_INFO),f_SetSpawnInfoPointer);
			POINTER_TO_MEMBER(SetSkinPointer,(void *)(R7_SET_SKIN),f_SetSkinPointer);
			POINTER_TO_MEMBER(KillForWorldPointer,(void *)(R7_KILL_FOR_WORLD),f_KillForWorld);
			POINTER_TO_MEMBER(SetWeaponSkillPointer,(void *)(R7_SET_WEAPON_SKILL),f_SetWeaponSkill);
			
			POINTER_TO_MEMBER(CPlayerPosXOffset,(void *)(R7_C_PLAYER_POS_X_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerPosYOffset,(void *)(R7_C_PLAYER_POS_Y_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerPosZOffset,(void *)(R7_C_PLAYER_POS_Z_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerHealthOffset,(void *)(R7_C_PLAYER_HEALTH_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerArmourOffset,(void *)(R7_C_PLAYER_ARMOUR_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerAngleOffset,(void *)(R7_C_PLAYER_ANGLE_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerStateOffset,(void *)(R7_C_PLAYER_STATE_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerFootSyncOffset,(void *)(R7_C_PLAYER_FOOT_SYNC_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerInCarSyncOffset,(void *)(R7_C_PLAYER_INCAR_SYNC_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerPassangerSyncOffset,(void *)(R7_C_PLAYER_PASSANGER_SYNC_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerAimSyncOffset,(void *)(R7_C_PLAYER_AIM_SYNC_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerAimSyncStateOffset,(void *)(R7_C_PLAYER_AIM_SYNC_STATE_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerSyncTypeOffset,(void *)(R7_C_PLAYER_SYNC_TYPE_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerWeaponSkillOffset,(void *)(R7_C_PLAYER_WEAPON_SKILL_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerSkinOffset,(void *)(R7_C_PLAYER_SKIN_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerInteriorOffset,(void *)(R7_C_PLAYER_INTERIOR_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerIsStreamedOffset,(void *)(R7_C_PLAYER_IS_STREAMED_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerVehicleIdOffset,(void *)(R7_C_PLAYER_VEHICLE_ID_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerVehicleSeatOffset,(void *)(R7_C_PLAYER_VEHICLE_SEAT_OFFSET),DWORD);
			
			POINTER_TO_MEMBER(CVehiclePosXOffset,(void *)(R7_C_VEHICLE_POS_X_OFFSET),DWORD);
			POINTER_TO_MEMBER(CVehiclePosYOffset,(void *)(R7_C_VEHICLE_POS_Y_OFFSET),DWORD);
			POINTER_TO_MEMBER(CVehiclePosZOffset,(void *)(R7_C_VEHICLE_POS_Z_OFFSET),DWORD);
			POINTER_TO_MEMBER(CVehicleDriverOffset,(void *)(R7_C_VEHICLE_DRIVER_OFFSET),DWORD);
			POINTER_TO_MEMBER(CVehicleModelOffset,(void *)(R7_C_VEHICLE_MODEL_OFFSET),DWORD);
			POINTER_TO_MEMBER(CVehicleHealthOffset,(void *)(R7_C_VEHICLE_HEALTH_OFFSET),DWORD);

			POINTER_TO_MEMBER(LoggingJoinPointer,(void *)(R7_JOIN_POINTER),DWORD);
			POINTER_TO_MEMBER(LoggingPartPointer,(void *)(R7_PART_POINTER),DWORD);
			break;
		}
	case SAMP_VERSION_038:
		{
			POINTER_TO_MEMBER(ClientConnectPointer,(void *)(R8_CLIENT_CONNECT),f_ClientConnect);
			POINTER_TO_MEMBER(ClientDisconnectPointer,(void *)(R8_CLIENT_DISCONNECT),f_ClientDisconnect);
			POINTER_TO_MEMBER(SpawnForWorldPointer,(void *)(R8_SPAWN_FOR_WORLD),f_SpawnForWorld);
			POINTER_TO_MEMBER(SetSpawnInfoPointer,(void *)(R8_SET_SPAWN_INFO),f_SetSpawnInfoPointer);
			POINTER_TO_MEMBER(SetSkinPointer,(void *)(R8_SET_SKIN),f_SetSkinPointer);
			POINTER_TO_MEMBER(KillForWorldPointer,(void *)(R8_KILL_FOR_WORLD),f_KillForWorld);
			POINTER_TO_MEMBER(SetWeaponSkillPointer,(void *)(R8_SET_WEAPON_SKILL),f_SetWeaponSkill);
			
			POINTER_TO_MEMBER(CPlayerPosXOffset,(void *)(R8_C_PLAYER_POS_X_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerPosYOffset,(void *)(R8_C_PLAYER_POS_Y_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerPosZOffset,(void *)(R8_C_PLAYER_POS_Z_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerHealthOffset,(void *)(R8_C_PLAYER_HEALTH_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerArmourOffset,(void *)(R8_C_PLAYER_ARMOUR_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerAngleOffset,(void *)(R8_C_PLAYER_ANGLE_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerStateOffset,(void *)(R8_C_PLAYER_STATE_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerFootSyncOffset,(void *)(R8_C_PLAYER_FOOT_SYNC_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerInCarSyncOffset,(void *)(R8_C_PLAYER_INCAR_SYNC_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerPassangerSyncOffset,(void *)(R8_C_PLAYER_PASSANGER_SYNC_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerAimSyncOffset,(void *)(R8_C_PLAYER_AIM_SYNC_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerAimSyncStateOffset,(void *)(R8_C_PLAYER_AIM_SYNC_STATE_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerSyncTypeOffset,(void *)(R8_C_PLAYER_SYNC_TYPE_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerWeaponSkillOffset,(void *)(R8_C_PLAYER_WEAPON_SKILL_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerSkinOffset,(void *)(R8_C_PLAYER_SKIN_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerInteriorOffset,(void *)(R8_C_PLAYER_INTERIOR_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerIsStreamedOffset,(void *)(R8_C_PLAYER_IS_STREAMED_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerVehicleIdOffset,(void *)(R8_C_PLAYER_VEHICLE_ID_OFFSET),DWORD);
			POINTER_TO_MEMBER(CPlayerVehicleSeatOffset,(void *)(R8_C_PLAYER_VEHICLE_SEAT_OFFSET),DWORD);
			
			POINTER_TO_MEMBER(CVehiclePosXOffset,(void *)(R8_C_VEHICLE_POS_X_OFFSET),DWORD);
			POINTER_TO_MEMBER(CVehiclePosYOffset,(void *)(R8_C_VEHICLE_POS_Y_OFFSET),DWORD);
			POINTER_TO_MEMBER(CVehiclePosZOffset,(void *)(R8_C_VEHICLE_POS_Z_OFFSET),DWORD);
			POINTER_TO_MEMBER(CVehicleDriverOffset,(void *)(R8_C_VEHICLE_DRIVER_OFFSET),DWORD);
			POINTER_TO_MEMBER(CVehicleModelOffset,(void *)(R8_C_VEHICLE_MODEL_OFFSET),DWORD);
			POINTER_TO_MEMBER(CVehicleHealthOffset,(void *)(R8_C_VEHICLE_HEALTH_OFFSET),DWORD);

			POINTER_TO_MEMBER(LoggingJoinPointer,(void *)(R8_JOIN_POINTER),DWORD);
			POINTER_TO_MEMBER(LoggingPartPointer,(void *)(R8_PART_POINTER),DWORD);
			break;
		}
	}
}
